/**
 * @author nttdocomo
 */
define(function(require) {
	// closure these in so they are only created once.
	var alpha = /^[a-zA-Z_]+$/, alphanum = /^[a-zA-Z0-9_]+$/, email = /^(\w+)([\-+.][\w]+)*@(\w[\-\w]*\.){1,5}([A-Za-z]){2,6}$/, url = /(((^https?)|(^ftp)):\/\/([\-\w]+\.)+\w{2,3}(\/[%\-\w]+(\.\w{2,})?)*(([\w\-\.\?\\\/+@&#;`~=%!]*)(\.\w{2,})?)*\/?)/i;
	aries.augmentObject("aries.form.field.Vtypes", {
		singleton : true,

		/**
		 * The function used to validate email addresses. Note that this is a very basic validation - complete
		 * validation per the email RFC specifications is very complex and beyond the scope of this class, although this
		 * function can be overridden if a more comprehensive validation scheme is desired. See the validation section
		 * of the [Wikipedia article on email addresses][1] for additional information. This implementation is intended
		 * to validate the following emails:
		 *
		 * - `barney@example.de`
		 * - `barney.rubble@example.com`
		 * - `barney-rubble@example.coop`
		 * - `barney+rubble@example.com`
		 *
		 * [1]: http://en.wikipedia.org/wiki/E-mail_address
		 *
		 * @param {String} value The email address
		 * @return {Boolean} true if the RegExp test passed, and false if not.
		 */
		'email' : function(v) {
			return email.test(v);
		},
		/**
		 * @property {String} emailText
		 * The error text to display when the email validation function returns false.
		 * Defaults to: 'This field should be an e-mail address in the format "user@example.com"'
		 */
		//<locale>
		'emailText' : 'This field should be an e-mail address in the format "user@example.com"',
		//</locale>
		/**
		 * @property {RegExp} emailMask
		 * The keystroke filter mask to be applied on email input. See the {@link #email} method for information about
		 * more complex email validation. Defaults to: /[a-z0-9_\.\-@]/i
		 */
		'emailMask' : /[a-z0-9_\.\-@\+]/i,

		/**
		 * The function used to validate URLs
		 * @param {String} value The URL
		 * @return {Boolean} true if the RegExp test passed, and false if not.
		 */
		'url' : function(v) {
			return url.test(v);
		},
		/**
		 * @property {String} urlText
		 * The error text to display when the url validation function returns false.
		 * Defaults to: 'This field should be a URL in the format "http:/'+'/www.example.com"'
		 */
		//<locale>
		'urlText' : 'This field should be a URL in the format "http:/' + '/www.example.com"',
		//</locale>

		/**
		 * The function used to validate alpha values
		 * @param {String} value The value
		 * @return {Boolean} true if the RegExp test passed, and false if not.
		 */
		'alpha' : function(v) {
			return alpha.test(v);
		},
		/**
		 * @property {String} alphaText
		 * The error text to display when the alpha validation function returns false.
		 * Defaults to: 'This field should only contain letters and _'
		 */
		//<locale>
		'alphaText' : 'This field should only contain letters and _',
		//</locale>
		/**
		 * @property {RegExp} alphaMask
		 * The keystroke filter mask to be applied on alpha input. Defaults to: /[a-z_]/i
		 */
		'alphaMask' : /[a-z_]/i,

		/**
		 * The function used to validate alphanumeric values
		 * @param {String} value The value
		 * @return {Boolean} true if the RegExp test passed, and false if not.
		 */
		'alphanum' : function(v) {
			return alphanum.test(v);
		},
		/**
		 * @property {String} alphanumText
		 * The error text to display when the alphanumeric validation function returns false.
		 * Defaults to: 'This field should only contain letters, numbers and _'
		 */
		//<locale>
		'alphanumText' : 'This field should only contain letters, numbers and _',
		//</locale>
		/**
		 * @property {RegExp} alphanumMask
		 * The keystroke filter mask to be applied on alphanumeric input. Defaults to: /[a-z0-9_]/i
		 */
		'alphanumMask' : /[a-z0-9_]/i
	})
})
